import Vue from 'vue'
import VueRouter from "vue-router";

import Layout from '@/views/Layout'
import ArticleDetail from '@/views/ArticleDetail'

import Article from '@/views/Article'
import Collect from '@/views/Collect'
import Like from '@/views/Like'
import User from '@/views/User'


Vue.use(VueRouter)

const router = new VueRouter({
  //配置两个一级路由
  routes: [
  {
    path:'/',
    component:Layout,
    redirect:'/article',//重定向 
    //二级路由
    children:[
      {
        path:'/article',
        component:Article
      },
      {
        path:'/collect',
        component:Collect
      },
      {
        path:'/like',
        component:Like
      },
      {
        path:'/user',
        component:User
      }
    ]
  },
  {
    path:'/detail/:id',//动态路由传参
    component:ArticleDetail
  }
  ]
})

export default router